0
int main(int argc, char** argv)
{
	char c[999];
	char alpha[2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','e','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
	int pos[26];
	int i=0;
	for(i=0;i<26;i++)
	{
		printf("%c\n",alpha[0][i]);
	}

}

This code is giving me an "error:exit code with return 1" and a lot of warning saying "excess elements in array initializer". I have kept searching the web and all I find is that I might have a bug with my gcc? I was wondering if anyone spotted a syntax error though because the code seemed to make perfect sense to me.--Thanks

2
Contributors
1
Reply
6
Views
7 Years
Discussion Span
Last Post by gerard4143
1

Try this, you had a typo in your array - 'a','b','c','e','d','e','f','g' - giving you excess elements plus a few more errors

#include <stdio.h>

int main(int argc, char** argv)
{
	char c[999];
	char alpha[2][26]={{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'},{'a','b','c','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}};
	int pos[26];
	int i=0;
	for(i=0;i<26;i++)
	{
		printf("%c\n",alpha[0][i]);
	}
	return 0;
}

Edited by gerard4143: n/a

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.