What is wrong with the following code?
int *foo()
{
int *s = malloc(sizeof(int)100);
assert(s != NULL);
return s;
}
Answer / susie
Answer : & Explanation:
assert macro should be used for debugging and finding out
bugs. The check s != NULL is for error/exception handling
and for that assert shouldn’t be used. A plain if and the
corresponding remedy statement has to be given.
| Is This Answer Correct ? | 0 Yes | 2 No |
main() { 41printf("%p",main); }8
main() { int i=-1; -i; printf("i = %d, -i = %d \n",i,-i); }
main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }
which function is used to clear the buffer stream on gcc? for example: I wrote following code on gcc #include<stdio.h> int main(void) { char ch; int a,b; printf("\nenter two numbers:\t"); scanf("%d%d",&a,&b); printf("enter number is %d and %d",a,b); printf("\nentercharacter:\t"); scanf("%c",&ch); printf("enter character is %c",ch); return 0; } in above progarm ch could not be scan. why?plz tell me solution.
How we print the table of 2 using for loop in c programing?
Sir... please give some important coding questions asked by product companies..
int a=1; printf("%d %d %d",a++,a++,a); need o/p in 'c' and what explanation too
write a program in c to merge two array
main() { printf("%d", out); } int out=100;
main() { char a[4]="HELL"; printf("%s",a); }
to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD
main() { int i = 100; clrscr(); printf("%d", sizeof(sizeof(i))); } a. 2 b. 100 c. 4 d. none of the above