#include<stdio.h> int main() { int *j; void fun(int**); fun(&j); return 0; } void fun(int **k) { int a=10; /* Add a statement here */ }
#include<stdio.h> int main() { char s[] = "CuriousTab"; char t[25]; char *ps, *pt; ps = s; pt = t; while(*ps) *pt++ = *ps++; /* Add a statement here */ printf("%s\n", t); return 0; }
#include<stdio.h> int main() { int arr[3][3] = {1, 2, 3, 4}; printf("%d\n", *(*(*(arr)))); return 0; }
#include<stdio.h> int main() { float a=3.14; char *j; j = (char*)&a; printf("%d\n", *j); return 0; }
#include<stdio.h> void fact(int*); int main() { int i=5; fact(&i); printf("%d\n", i); return 0; } void fact(int *j) { static int s=1; if(*j!=0) { s = s**j; *j = *j-1; fact(j); /* Add a statement here */ } }
#include<stdio.h> int main() { int i=10; int *j=&i; return 0; }
#include<stdio.h> #include<string.h> int main() { static char s[] = "Hello!"; printf("%d\n", *(s+strlen(s))); return 0; }
#include<stdio.h> #include<string.h> int main() { char str1[20] = "Hello", str2[20] = " World"; printf("%s\n", strcpy(str2, strcat(str1, str2))); return 0; }
Step 2: printf("%s\n", strcpy(str2, strcat(str1, str2)));
=> strcat(str1, str2)) it append the string str2 to str1. The result will be stored in str1. Therefore str1 contains "Hello World".
=> strcpy(str2, "Hello World") it copies the "Hello World" to the variable str2.
Hence it prints "Hello World".
#include<stdio.h> int main() { char str1[] = "Hello"; char str2[] = "Hello"; if(str1 == str2) printf("Equal\n"); else printf("Unequal\n"); return 0; }
Step 2: char str2[] = "Hello"; The variable str2 is declared as an array of characters and initialized with a string "Hello".
We have use strcmp(s1,s2) function to compare strings.
Step 3: if(str1 == str2) here the address of str1 and str2 are compared. The address of both variable is not same. Hence the if condition is failed.
Step 4: At the else part it prints "Unequal".
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.