ખીલો ખોદતા ખાણ જો મળે ઝવેરાતની, તો નિરાંતે તારી ભક્તિ કરું શામળા | ભલું થયું ભાંગી જંજાળ, નવી નક્કોર દેશે શ્રીગોપાળ | જે તુજથી ના થઈ શકે એ જ કરાવ પ્રભુ પાસે, પાણિયારું પ્રભુ ભરશે નહિ ભરશે નદી તળાવ

Kiran Chauhan

Cogito, ergo sum // I think, therefore I am.

TIL: Recommended Way to Define Pointer Variables in C

— ,

Today, I learn that we should use int* x to define a pointer variable than int *x. Why?

Following is the way, we can define a variable in C.

int x = 3;
printf("%d\n", x); // prints "3".

If we prefix this x variable with & as &x, it'll returns the address of given variable. The type of this return address is int* meaning address of integer and * as pointer to that address.

int* address = &x;

To print the address, we can use %p as placeholder.

printf("%p\n", address);

Notice, here I wrote address and not *address. Because, * is not part of address variable name than part of type.


સાહિત્યિક કાર્યક્રમો

  • તા. ૨૧-૨૫ ઓક્ટોબર ૨૦૨૬ - સંસ્કૃત વાગ્માધુરી ૨૦૨૬, રા. વિ. પાઠક સભાગૃહ, ગુજરાતી સાહિત્ય પરિસદ, આશ્રમ રોડ, અમદાવાદ.
  • તા. ૨૪–૨૫ ઓક્ટોબર ૨૦૨૬ - અમદાવાદ ઇન્ટરનેશનલ લિટરેચર ફેસ્ટિવલ
  • વધુ માહિતી માટે...

વર્ગીકૃત

કડીઓ

સૂચિત લેખો

ચોપડીઓ

જોયેલ