15,552 Topics

Member Avatar for
Member Avatar for Eonimal

Hello! I am trying to make a mimic code of LS command in C. It is compiled with gcc in ubuntu, and I have some questions to ask. I have used opendir to open current directory, and then i read each directory using while loop to print all the directories …

Member Avatar for Eonimal
0
228
Member Avatar for Freude

I am newbie in controllers' programming. Recently, reading manual about ADSP controllers, I saw the key word ".section" in the c code. In another books I saw just "section" without dot. What do these directives mean? And is there any difference between these cases? My compiler works fine with "section," …

Member Avatar for Freude
0
84
Member Avatar for dellat

Has the following code any practical utility apart from showing the working of pointers? I got it while learning c in which the tutorial showings the features of pointer. Does a C programmer use this kind of code where a int pointer has been declared first and assigned a value …

Member Avatar for dellat
0
172
Member Avatar for shaunchu

All right. So I'm taking an assembly language class, but we apparently also need to use a smattering of Unix and C. Our assignment is to create a function that converts from the input base to a listed base. Example of a call: ConvertToBase(057,10) should return 47 (the input was …

Member Avatar for cse.avinash
0
112
Member Avatar for N1GHTS

Lets say I have a shared library in Linux, written in C, with a single function that simply returns the pointer to a string literal. [code]void *ReturnObject() { return (void *)"\xFA\x03\x44\x10\xE0"; }[/code] When this library is loaded by the host application at runtime and this function is called, is the …

Member Avatar for N1GHTS
0
150
Member Avatar for Rupindersingh

What is EOF. How is it generated? Which key corresponds to "end of file" on the keybord??

Member Avatar for Rupindersingh
0
117
Member Avatar for Rupindersingh

Can anyone please debug the following binary tree program, it flashes two errors: 1: Type mismatch in redeclaration of 'strdup' 2: Tpe mismatch in redeclaration of 'talloc' [CODE]#include<stdio.h> #include<ctype.h> #include<string.h> #define MAXWORD 100 struct tnode *addtree(struct tnode *, char *); void treeprint(struct tnode *); struct tnode { char *word; int …

Member Avatar for Narue
0
242
Member Avatar for apanimesh061

Here is a program to create two threads in which parent thread read the count of character in inputting string and child thread reverse the string up to that count ! [CODE] #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <pthread.h> struct pass { int c; char *arr; }; …

0
66
Member Avatar for radhika kotecha

Hello, I am working with genetic programming for classification techniques in data mining. I am not very much clear about how to perform genetic programming in C. Can i please get some sample code of genetic programming... An example program for any application would be fine. I just need some …

Member Avatar for TrustyTony
0
248
Member Avatar for Muhasin
Member Avatar for N1GHTS
0
85
Member Avatar for geeksforgeek
Member Avatar for geeksforgeek
0
122
Member Avatar for saurav2007

I got the problem with this code.. can anyone explain me the output.. main() { int i = 258; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );}

Member Avatar for saurav2007
0
121
Member Avatar for kylelendo

Hii I have developed a code in which i have two check those 2 digit numbers whose 3 times sum is equal to the number eg:-27=3(2+7) [CODE] #include<conio.h> #include<stdio.h> int main() { clrscr(); int a,b,n; long sum=0; loop:for(n=24;n<=28;n++) { a=n/10; b=n%10; sum=sum+(a+b); } if(n==(3*sum)) { printf("%d \n",n); } else { …

Member Avatar for scrappy57
0
158
Member Avatar for aFg3

Hi people im new here. I want to work with security but i got many issues with this simple program. I want to encrypt and decrypt a msg with openssl cmds. Btw im using pipeline and process open (popen) function. Im using Fedora gcc to compile. Any help, recommendations will …

Member Avatar for Mouche
0
150
Member Avatar for asrockw7

So from what I've been taught, in school and in books, all C programs(I assume C++ too) always have main(). That's very explicitly mentioned. However in my poking around with some relatively large open source projects in hopes of learning something, it isn't as straight forward. What I've encountered was …

Member Avatar for Moschops
0
162
Member Avatar for RideFire

I know C++, but I'm trying to learn C. Anyways, what am I doing wrong here. If I delete the line with 'scanf', it will compile so obviously I'm doing something wrong there. Anyways... [CODE]#include <stdio.h> int main() { int x; printf("enter a number\n"); scanf("%d", &x); printf("Your number is: %d\n", …

Member Avatar for RideFire
0
93
Member Avatar for emrecaglarhosgo

need a[CODE][/CODE] in C that converts any given BCD to GRAY Code, and any given GRAY to BCD. I am a started so little halp ;)

Member Avatar for aFg3
0
170
Member Avatar for challarao

Hi, I got a doubt about for loop while i was thinking about time complexity.... Is increment operation in for loop a two steps operation i.e., increment i and assign it the i or an one step operation just like just incrementing it? Is there any pointer operation involved in …

Member Avatar for challarao
0
144
Member Avatar for catalin4

Hello. I have a file merg.txt: [COLOR="Red"]1 3 11 14 1 5 8 13 1 1 9 10 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 1 12 13 3 3 3 3 3 3 3 3 3 3[/COLOR]

Member Avatar for catalin4
0
101
Member Avatar for Rass Saee

I need to get the current time from Internet using C language. Any help is appreciated, hopefully a source code sample. Thank you in advance.

Member Avatar for naavinm
0
133
Member Avatar for Jamblaster

Title says it all: I am wondering in what kind of situations a programmer would use a union vs using a structure. I'm pretty new to this stuff and my book only devotes about 2 pages to Unions so it isn't the best source of info on Unions really, but …

Member Avatar for rubberman
0
490
Member Avatar for geojia

I've been trying to code a link list in c and though it seems fairly straight forward I'm getting strange output. My link list nodes: [CODE] struct OBJECT { int Status; struct OBJECT *P_LINK; struct OBJECT *N_LINK; struct VALUE *P_VALUE; }; [/CODE] Link list [CODE] struct llist { struct OBJECT …

Member Avatar for nezachem
0
105
Member Avatar for urbangeek

well...i tried in google...but actually i didn't quite get it. :) [url]http://www.thinkage.ca/english/gcos/expl/c/lib/fflush.html[/url] in the above link they are saying, user should definitely NOT write code of the form [CODE]printf("Prompt: "); fflush(stdout); gets(s);[/CODE] but before we used fflush after printf...for example [URL="http://www.daniweb.com/forums/post1168561.html#post1168561"]here[/URL] jephthah gave a solution where he used fflush after …

Member Avatar for Narue
0
2K
Member Avatar for geeta_11

I wanted to know the advantage of consts over macros. And I found the line "The main disadvantage of macro is it doesn't do type checking.". Is it not an advantage of macro? So that I can #define any constants without a limit. Can you pls explain me why it …

Member Avatar for Narue
0
100
Member Avatar for gihanbw

hi, i wrote the following piece code to create a new bitmap file with random RGB values. I wanted to copy the header from the input file. the problem is it adds two additional bytes to 3rd and 4th (just after the magic number). i can't figure out why. // …

Member Avatar for gihanbw
0
459
Member Avatar for scirdan

I am trying to port some software from an embedded product into the windows environment using VS2010. Its C code and it has 2 threads that send messages to each other. Whats the best method for communication? I am having a hard time finding the right way to do a …

0
42
Member Avatar for saurav2007

Hi i got some problems with c pointers...feelin trouble to get through it..here is a problem .anyone plz explain the solutin to me.. #include<stdio.h> main() { int arr[3]={2,3,4}; char *p=arr; p=(char*)((int*)(p)); printf("%d",*p); p=(int*)(p+1); printf("%d",*p); }

Member Avatar for cse.avinash
0
189
Member Avatar for guggenheim

Hi, I am trying to create a UDP broadcast server so that I can send out data to every computer on our local network for aircraft testing. I can get every component of the system to work except for the broadcast part... As I understand it, if I want to …

Member Avatar for Ben Mehlman
0
699
Member Avatar for akhilchandranms

[CODE]#include<stdio.h> #include<conio.h> void main() { int x=01234; printf("%d",x); }[/CODE] the above c code will produce output 668(value of x) why?

Member Avatar for cse.avinash
0
100
Member Avatar for Anil2447

Here is the codes for Binary Search and Linear Search. [B]Binary Search[/B] [CODE] #include<stdio.h> int main(){ int a[10],i,n,m,c=0,l,u,mid,j,x; //variable assigning printf("Enter the size of an array->"); //Entering the size of the array scanf("%d",&n); printf("\nEnter the elements of the array->");//Entering the array elements for(i=0;i<n;i++){ scanf("%d",&a[i]); } for(i=0;i<n;i++) { //loop to sort …

0
114

The End.