Pointers
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
char *s = "Interview Mania";
char strArray[] = "Interview Mania";
printf("%d %d\n", sizeof(s), sizeof(strArray));
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
8 16
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
char s[] = "Interveiw Mania";
s[9] = '.';
printf("%s\n", s);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Interveiw.Mania
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
char *ch = "Interview Mania\n";
ch[9] = '.';
printf("%s\n", ch);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Segmentation fault
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
char *s1 = "Hey Bro...\n";
char s2[] = "How are u?\n";
strcpy(s2, s1);
printf("%s\n", s2);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Hey Bro...
- What will be the output of the following C code?
#include <stdio.h>
int main()
{
char *s1 = "Interview Mania ";
char s2[] = "welcome to\n";
strcpy(s2, s1);
printf("%s\n", s2);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Interview Mania