Mistři v programování na #hovnokod

Je to kod na embedded zariadenie, takze stdint.h nie je tak uplne dostupne. Ale aj tak ma ten kod jednu zjavnu a jednu nie uplne zjavnu, ale o to zavaznejsiu chybu.

#ifndef uint32_t
typedef unsigned int uint32_t;
#endif

Anonymous,

"Ale v Qt mi to funguje"

#include <stdio.h>
typedef struct{
    int cit,jm;
}ZLOMEK;
void nacti();
void vypis();
void soucet();
void cele();
int main()
{
    nacti();
    vypis();
    soucet();
    cele();
    return 0;
}
void nacti()
{
    ZLOMEK x;
    printf("Zadej citatel");
    scanf("%d",&x.cit);
    printf("Zadej jmenovatel");
    scanf("%d",&x.jm);
}
void vypis()
{
    ZLOMEK x;
    printf("[%d/%d]\n",x.cit,x.jm);
}
void soucet()
{
    ZLOMEK ZL1,ZL2;
    int cit=0,jm=0;
    printf("\nZadej citatel ZL1:");
    scanf("%d",&ZL1.cit);
    printf("\nZadej jmenovatel ZL1:");
    scanf("%d",&ZL1.jm);

    printf("\nZadej citatel ZL2:");
    scanf("%d",&ZL2.cit);
    printf("\nZadej jmenovatel ZL2:");
    scanf("%d",&ZL2.jm);
    jm=ZL1.jm*ZL2.jm;
    cit=ZL1.cit*ZL2.jm+ZL2.cit*ZL1.jm;
    printf("\n[%d/%d]\n",cit,jm);
}
void cele()
{
    ZLOMEK x;
    int c,s=0;
    printf("\nZadej cele cislo:");
    scanf("%d",&c);
    printf("\nZadej citatel zlomku:");
    scanf("%d",&x.cit);
    printf("\nZadej jmenovatel zlomku:");
    scanf("%d",&x.jm);
    s=c*x.jm+x.cit;
    printf("\n[%d/%d]",s,x.jm);
}

Anonymous,


Anonymous,

#include <stdio.h>

int main()
{
int c,d,b,g,r,k,x;
scanf("%d", &c);
x=1;
b=c;
g=0;
r=0;
d=0;
k=0;
c=16-c;
if(c>=1 && c<15 && c%2!=0){
for(c; c<=15; c++){
	g++;
	r++;
    x++;
	while(d<g){
		printf("*");
	d++;}
		while(r<b){
		printf("-");
		r++;
		}
		printf("\n");
		d=0;
		r=0;
		b--;
}
b=g-1;
g=1;
d=0;
for(k; k<c; k++){
while(r<b){
		printf("*");
		r++;
		}
	while(d<g){
		if(b>=1){
		printf("-");
	d++;}
	}
		printf("\n");
		r=0;
		d=0;
		b--;	
		g++;
}
}
else
	printf("cislo nie je z daneho intervalu\n");
getch();
return 0;
}

Anonymous,

Zas nějaký takyprogramátor.

 // Init (for tests start out side of actual source code (sector 0...4) => Sector 5,6 and 7)
   Akt_Sektor    = 5;
        if (Akt_Sektor == 0) Update.SW.Ptr = (unsigned long*) 0x08000000;
   else if (Akt_Sektor == 1) Update.SW.Ptr = (unsigned long*) 0x08004000;
   else if (Akt_Sektor == 2) Update.SW.Ptr = (unsigned long*) 0x08008000;
   else if (Akt_Sektor == 3) Update.SW.Ptr = (unsigned long*) 0x0800C000;
   else if (Akt_Sektor == 4) Update.SW.Ptr = (unsigned long*) 0x08010000;
   else if (Akt_Sektor == 5) Update.SW.Ptr = (unsigned long*) 0x08020000;
   else if (Akt_Sektor == 6) Update.SW.Ptr = (unsigned long*) 0x08040000;
   else                      Update.SW.Ptr = (unsigned long*) 0x08060000;

   // Unlock Flash
   (*FLASH).KEYR = 0x45670123;
   (*FLASH).KEYR = 0xCDEF89AB;

   // Wait for the BSY bit to be cleared
   while ( ((*FLASH).SR & (0x01 << 16)) == (0x01 << 16) )
         { __NOP; }

Anonymous,