0

sizeof operator using pointers

#include<stdio.h> #include<string.h> int main() { char a[]="Access\0"; char b[]="Access"; char *p="Access\0"; char *q="Access"; if(p==q) { printf("\n"); printf("Access 1"); } if(sizeof(a)==sizeof(b)) { printf("\nAccess 2"); } if(sizeof(p)==sizeof(q)) { printf("\nAccess 3"); } if(strlen(a)==strlen(b)) { printf("\nAccess 4"); } if(strlen(p)==strlen(q)) { printf("\nAccess 5"); } return 0; }

9th Nov 2020, 6:23 AM
Rohit Upadhyay
Rohit Upadhyay - avatar
3 Answers
+ 8
U should try yourself in playground
9th Nov 2020, 6:24 AM
Sâùtôsh
Sâùtôsh - avatar
0
Anyone gave the output of this code ??
9th Nov 2020, 6:23 AM
Rohit Upadhyay
Rohit Upadhyay - avatar
0
And how this code work ??
9th Nov 2020, 6:23 AM
Rohit Upadhyay
Rohit Upadhyay - avatar