C programming Questions
C programming For Recent college graduates and professionals for job interview.:
some small C programs are given asked to tell the function/errors etc.
one of the question(last in the paper) is an invalid statement. finish of all these very fast and think about those others. they are simple only.
int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c);
3.whole logic is given in func s but they are working properly. the main logic is :
string=malloc(5*sizeof(char)); strcpy(string,"hello"); printf("%s",string); /* func to print */
ANS: hello and some extra characters until uccerence of \0 .
4. in a system integer takes 3bytes and char takes 1byte …….
int a; char b; };
ANS : sizeof struct smithing is 7 bytes.