Skip to content

Instantly share code, notes, and snippets.

@lopesivan
Created December 15, 2022 18:54
Show Gist options
  • Save lopesivan/a5fc33f1182d55b9463e214dff377eac to your computer and use it in GitHub Desktop.
Save lopesivan/a5fc33f1182d55b9463e214dff377eac to your computer and use it in GitHub Desktop.
#include <stdio.h>
struct speed {
int x;
int y;
};
void aumenta(struct speed *speed);
void aumenta(struct speed *speed){
speed->x += 10;
speed->y += 10;
}
int main(int argc, char *argv[])
{
struct speed speed = {10,4};
/* struct speed speed = {.x=10,.y=3}; */
printf("Velocidade X=%d, Y=%d\n", speed.x, speed.y);
aumenta(&speed);
printf("Velocidade X=%d, Y=%d\n", speed.x, speed.y);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment