0

Hi All,

Can somebody explain what is the difference between (char*) and (char**).

I am just looking for an explanation of in byte level.

Also please refer any documents related to this.

Thanks

3
Contributors
4
Replies
6
Views
6 Years
Discussion Span
Last Post by sree_ec
0

Can you explain more about Byte level??

Just remember one thing:

char* = char[]     //1D array of chars
char** = char[][]  //2D array of chars
0

thanks for the reply...

i just need to know *(char**)&a ...so what is the role of char** in this .I know that char* means pointer casting of 1 byte but im always confused with char**

0

I'm trying to analyze what you mean!!
Let's ask C compiler to answer your question. By the way, remember allocation size is so much dependent on the machine that is running the code.

#include <stdio.h>

int main()
{
  char i[1];
  char j[1][1];

  printf("Size of char* is: %d\n", sizeof(i));
  printf("Size of char** is: %d\n", sizeof(j));
}
0

thanks for the reply...

i just need to know *(char**)&a ...so what is the role of char** in this .I know that char* means pointer casting of 1 byte but im always confused with char**

** means pointer to a pointer
char** a; means a is a pointer to a pointer which points to a single/sequence of characters[character array].
So if we increment a, it 'might' point to another character array

char ** can be used to represent two dimensional character arrays or array of strings...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.