OUTPUT???

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
const char arr[]="ABCD";
fun(){
printf("SIze of arr %lu\n",sizeof((unsigned long)sizeof(arr)));
}
main(){
clrscr();
fun();
}
You have forgot the function return types.
void fun(){

int main(){
Last edited on
You also need to call fun In main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

const char* arr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const char arr2[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

void fun(void) {
	printf("Size of arr %lu\n",(unsigned long)sizeof(arr));
	printf("Size of arr2 %lu\n",(unsigned long)sizeof(arr2));
	printf("Length of arr %lu\n",(unsigned long)strlen(arr));
}

int main(void) {
	fun();

	return 0;
}

Just wondering: Should not be the size of arr2 4 bytes, too? Because arr and arr2 are both pointers to a string. On my machine arr2 is length of string incl. null terminator...
shadow123 wrote:
Should not be the size of arr2 4 bytes, too? Because arr and arr2 are both pointers to a string.

arr2 is an array. Not a pointer.
just give me the output along with explanation
HELP ME Regarding this,thank you!!!
We're not going to do it for you. If you want the output, just fix your code and then run it so you can see it for yourself. You're almost there...
Topic archived. No new replies allowed.