Good day, can you give me some sample program that hold string in 3 dimensional array.. because our instructor didn't expound the discussion about multidimensional array then is it useful in our final project this semester..Hoping for reply

Thank You

No. But I will give you this.

#include <stdio.h>

int main() {
	int i;
	char oneDimensional[]="I am one-dimensional!\n";
	char twoDimensional[5][5]={
			"I am",
			{'t','w','o','-',0},
			"dime",
			"nsio",
			"nal!"
	};
	printf("%s",oneDimensional);
	for(i=0;i<5;i++){
		printf("%s",twoDimensional[i]);
	}
	return 0;
}

Which outputs this:

I am one-dimensional!
I amtwo dimensional!

Yes, I know it's missing a space. However, to keep it inside 5x5 and include the trailing 0's at the same time, I realized I was too lazy to fix it.

No. But I will give you this.

#include <stdio.h>

int main() {
	int i;
	char oneDimensional[]="I am one-dimensional!\n";
	char twoDimensional[5][5]={
			"I am",
			{'t','w','o','-',0},
			"dime",
			"nsio",
			"nal!"
	};
	printf("%s",oneDimensional);
	for(i=0;i<5;i++){
		printf("%s",twoDimensional[i]);
	}
	return 0;
}

Which outputs this:

I am one-dimensional!
I amtwo dimensional!

Yes, I know it's missing a space. However, to keep it inside 5x5 and include the trailing 0's at the same time, I realized I was too lazy to fix it.

Thank you for the reply DeanMSands3, i have some in idea in 1d and 2d array in integer.. all i need is in string because in my program it deals with string that can be search,deleted, edit and more, also use 3d array with this program...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.