Results 1 to 7 of 7

Thread: Arrays of chars

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2001
    Posts
    57

    Arrays of chars

    I am having great difficulty getting this code to work.

    Code:
    #include <string.h>
    #include <stdio.h>
    
    void main(){
    	const int numsqu=30;
    	char square[numsqu][numsqu];
    	int i=0, x=0;
    	for (i = 0;i<numsqu;i++){
    		for (x = 0;x<numsqu;x++){
    			square[i][x] = ' ';
    		}
    	}
    	char row[numsqu][numsqu];
    	char tempp[numsqu];
    	for (i = 0;i<numsqu;i++)
    		sprintf(row[i],"\0");
    	for (i = 0;i<numsqu;i++){
    		for (x = 0;x<numsqu;x++){
    			sprintf(tempp,"%s",row[i]);
    			sprintf(row[i],"%s%s \0",tempp,square[i][x]);  //Problem Code!
    		}
    	}
    
    }
    Am I missing something simple? It compiles fine, but I cannot determine where the error is coming from. I'm using VC++ 6.


    Thanks for any help,


    chilibean
    Last edited by chilibean; May 26th, 2001 at 09:04 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width