Jump to content

Recommended Posts

Posted
Γράψτε ένα πρόγραμμα (με συνάρτηση void shift) το οποίο αφού εισάγει μια ακέραια τιμή έστω α, στη συνέχεια με την συνάρτηση shift να μηδενίζει την τιμή του α.

 

Μπορεί κάποιος να μου δώσει τη λύση. Ευχαριστώ !

Posted
#include <stdio.h>

void shift(int*);

int main(void)
{
int a;
printf("Doste tin timi a");
scanf("%d",&a);
shift(&a);
printf("H kenouria timi tou a einai : %d",a);
}

void shift(int *a)
{
*a=0;
}

Σημειώσεις:

Δουλεψα με δείκτες γιατί μου λες οτι η συνάρτηση δεν κάνει τίποτα (void)

Δεν το εχω δοκιμασει μπορει να εχω κανει κανενα λαθακι.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..