Lista e objektivave
Deklarim i shënjuesve
Veprime mbi shënjues
Çfarë afishon programi?
#include <stdio.h>
int main(void)
{
char ch = 'c';
char *chptr = &ch;
int i = 20;
int *intptr = &i;
float f = 1.20000;
float *fptr = &f;
char *ptr = "I am a string";
printf("\n [%c], [%d], [%f], [%c], [%s]\n", *chptr, *intptr, *fptr, *ptr, ptr);
return 0;
}
Zgjidhje
[c], [20], [1.200000], [I], [I am a string]
Çfarë afishon programi?
#include<stdio.h>
struct st{
int a;
char ch;
};
int main(void)
{
struct st obj;
struct st *stobj = &obj;
stobj->a = 5;
stobj->ch = 'a';
printf("\n [%d] [%c]\n", stobj->a, stobj->ch);
return 0;
}
Zgjidhje
[5] [a]
#include <stdio.h>
void gjej(int a, int b, int * sip, int * perim);
int main()
{
int x, y;
int sip, perim;
printf("Vendos dy vlera: " );
scanf("%d %d", &x, &y);
rectangle(x, y, &sip, &perim);
printf("Siperfaqe: %d Perimeter: %d\n", sip, perim);
return 0;
}
void gjej(int a,int b,int * sip,int * perim)
{
*sip = a * b;
*perim = 2 * (a + b);
}