Results 1 to 8 of 8

Thread:

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User garybo's Avatar
    Join Date: Jul:2007
    Location: Sofia
    Posts: 4

    , : . :
    Error CD3.C 29: Lvalue required in function main
    Error CD3.C 30: Lvalue required in function main
    Warning CD3.C 41: 'temp' is assigned a value that is never used in function main
    , . . -, ...
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    int main(void)
    {  int i;
    	char duma[5][10], *temp;
    	FILE *filename;
    	filename = fopen("fff","w");  /*otvariane na fail za zapis*/
    	if (filename == NULL)     {
    		printf("\n Failut %s ne moje da bude otvoren!\n",filename);
    		exit(1);}
    	else
    			for(i=0;i<5;i++)
    			{printf ("Vuvedete duma No:%d ", i+1);
    			gets (duma[i]);
    			fputs(duma[i],filename); /*vuvejdane i zapis na duma vuv faila*/
    			}
    			fclose (filename); /*zatvariane na fiala*/
    
    		/*sortirane na dumi vuv faila*/
    	if ((filename == fopen("fff","r"))== NULL) {
    	printf("Ne moje da se otvori tozi fail\n");
    	exit(1);
    	}
    	  /*sortirane na dumite*/
    		for(i=0;i<5;i++) {
    			if (duma[i]>duma[i+1])
    		  {	temp = duma[i];
    				duma[i] = duma[i+1];
    				duma[i+1] = temp;
    				}  }
    
    			/*razpe4atvane na sortiranite dumi*/
    
    	 printf("Sortiranite dumi sa:\n");
    	 for (i=0;i<5;i++)
    	 printf(duma[i]);
    
    	return 0;
    
    }

  2. #2
    Pesho's Avatar
    Join Date: Nov:2001
    Location: Sofia
    Posts: 5,169
    :

    if ((filename == fopen("fff","r"))== NULL) {

    ?

  3. #3
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448
    ,
    Code:
     {	
    				temp = duma[i];
    				duma[i] = duma[i+1];
    				duma[i+1] = temp;
    }
    C ( C (char*) , ). "temp" (. char temp[10]) strcpy().

    ...
    , . .
    "640K ught to be enough for anybody" - Bill Gates, 1981
    ::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel

  4. #4
    Registered User
    Join Date: Nov:2005
    Location:
    Posts: 3,317

    Code:
     if ((filename == fopen("fff","r"))== NULL) {
    a
    Code:
    strncpy(duma[i],duma[i+1],strlen(duma[i+1]));

    Code:
    duma[i] = duma[i+1];

  5. #5
    Registered User kernel_daemon's Avatar
    Join Date: Nov:2005
    Location: at 0000:7c00
    Posts: 940
    An year spent in artificial intelligence is enough to make one believe in God.
    Powered by ArchLinux.

  6. #6
    Registered User garybo's Avatar
    Join Date: Jul:2007
    Location: Sofia
    Posts: 4
    , . , .

  7. #7
    Deleted User 4eRNoBiL's Avatar
    Join Date: Oct:2005
    Location:
    Posts: 739
    Code:
    printf("\n Failut %s ne moje da bude otvoren!\n",filename);
    , , . . "fff", filename FILE, , . - , .

    fclose(...) else, .

    Code:
    printf("Sortiranite dumi sa:\n");
    	 for (i=0;i<5;i++)
    	 printf(duma[i]);
    printf .
    Fujistu Lifebook E756 | Core i7-6500U / 400MHz-3.1GHz | 8 GB DDR4-2133 | Samsung PM871 / 256 GB SSD | 15" 1920x1080 | Manjaro Linux + kernel 4.19

  8. #8
    Registered User garybo's Avatar
    Join Date: Jul:2007
    Location: Sofia
    Posts: 4
    [QUOTE=4eRNoBiL;1234588]
    Code:
    printf("\n Failut %s ne moje da bude otvoren!\n",filename);
    , .

Posting Permissions

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

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |