main()
{
char *p="GOOD";
char a[ ]="GOOD";
printf("\n sizeof(p) = %d, sizeof(*p) = %d, strlen(p) = %d",
sizeof(p), sizeof(*p), strlen(p));
printf("\n sizeof(a) = %d, strlen(a) = %d",
sizeof(a), strlen(a));
}
Answer / susie
Answer :
sizeof(p) = 2, sizeof(*p) = 1, strlen(p) = 4
sizeof(a) = 5, strlen(a) = 4
Explanation:
sizeof(p) => sizeof(char*) => 2
sizeof(*p) => sizeof(char) => 1
Similarly,
sizeof(a) => size of the character array => 5
When sizeof operator is applied to an array it returns the
sizeof the array and it is not the same as the sizeof the
pointer variable. Here the sizeof(a) where a is the
character array and the size of the array is 5 because the
space necessary for the terminating NULL character should
also be taken into account.
| Is This Answer Correct ? | 1 Yes | 1 No |
What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?
main() { int x=5; clrscr(); for(;x==0;x--) { printf("x=%d\n”", x--); } } a. 4, 3, 2, 1, 0 b. 1, 2, 3, 4, 5 c. 0, 1, 2, 3, 4 d. none of the above
Sorting entire link list using selection sort and insertion sort and calculating their time complexity
1 Answers Infosys, Microsoft, NetApp,
How we will connect multiple client ? (without using fork,thread)
main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }
#include <stdio.h> int main(void) { int a=4, b=2; a=b<<a+b>>2 ; printf("%d",a); return 0; }
main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }
how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.
0 Answers Mbarara University of Science and Technology,
main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?
Write a program that find and print how many odd numbers in a binary tree
To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates.
19 Answers Amazon, BITS, Microsoft, Syncfusion, Synergy, Vector,
#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s=malloc(sizeof(struct xx)); printf("%d",s->x); printf("%s",s->name); }