verständnisproblem



  • #include "stdafx.h"
    
    void Fkt4 (char* c, int x){
    	int i;
    	for(i=1; i<x; i++){
    		cout << i << " c " << c << "\n";
    		*c = *c-8;
    		cout << i << " c " << c << "\n";
    		c++;
    		//c+=1;
    		//c+=2;
    		//c-=1;
    		cout << i << " c " << *c << "\n";	
    
    		cout << "-----------" << "\n";
    	}
    }
    
    int _tmain(int argc, _TCHAR* argv[]){
    	char Dat[][4]= {"ABC", "DEF", "KLM"};
    	int y;
    	for(y=1; y<3; y++){
    		cout << y << " y " << Dat[y] << "\n";	
    		cout << "-----------" << "\n";
    
    		Fkt4(Dat[y], 3);		
    		cout << y << " y " << Dat[y] << "\n";	
    		cout << "-----------" << "\n";
    
    	}
    	system("pause");
    	return 0;
    }
    

    Hier ein quelltext den ich nicht ganz verstehe:
    In der Funktion Fkt4 wird mit c++ c erhöht, bei der ausgabe wird beim ersten Schleifendurchlauf nur noch F angezeigt. Was passiert bei c++ und warum wird nur noch ein Wert des char Arrays angezeigt?


Anmelden zum Antworten