Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,851 questions

51,772 answers

573 users

How to use 2D array of characters name as a pointer in C

5 Answers

0 votes
#include <stdio.h>

int main(int argc, char **argv)
{ 
	char arr[2][3] = {{'a','b','c'},{'d','e','f'}}; 
	
    printf("%s\n", *arr); 

	return 0; 
}   
 

/*
run:
 
abcdef
 
*/

 



answered Jan 19, 2019 by avibootz
0 votes
#include <stdio.h>

int main(int argc, char **argv)
{ 
	char arr[2][3] = {{'a','b','c'},{'d','e','f'}}; 
	
    printf("%s\n", *(arr + 1)); 

	return 0; 
}   
 

/*
run:
 
def
 
*/

 



answered Jan 19, 2019 by avibootz
0 votes
#include <stdio.h>

int main(int argc, char **argv)
{ 
	char arr[2][3] = {{'a','b','c'},{'d','e','f'}}; 
	
    printf("%c\n", *(*(arr + 0))); 
    printf("%c\n", *(*(arr + 1))); 
	
	return 0; 
}   
 

/*
run:
 
a
d
 
*/

 



answered Jan 19, 2019 by avibootz
0 votes
#include <stdio.h>

int main(int argc, char **argv)
{ 
	char arr[2][3] = {{'a','b','c'},{'d','e','f'}}; 
	
    printf("%c\n", *(arr + 0)[0]); 
    printf("%c\n", *(arr + 1)[0]); 
	
	return 0; 
}   
 

/*
run:
 
a
d
 
*/

 



answered Jan 19, 2019 by avibootz
0 votes
#include <stdio.h>

int main(int argc, char **argv)
{ 
	char arr[2][3] = {{'a','b','c'},{'d','e','f'}}; 
	
    printf("%c\n", **(arr + 0) + 1); 
    printf("%c\n", **(arr + 1) + 1); 
	
	return 0; 
}   
 

/*
run:
 
b
e
 
*/

 



answered Jan 19, 2019 by avibootz

Related questions

1 answer 150 views
2 answers 120 views
1 answer 128 views
128 views asked Nov 27, 2021 by avibootz
1 answer 159 views
4 answers 212 views
...