c - invalid operands of type 'int' to 'int*' to binary 'operator*' -


i working on program swaps 2 integer variables. when compile error

invalid operands of type 'int' 'int*' binary 'operator*'

on line 30 (second last line).

#include <stdio.h> #include <stdlib.h>  void swap_2(int *x, int *y);  int main(void) {     int i1, i2;      printf("enter 2 integers\n");     scanf("%d %d", &i1, &i2);     printf("i1 = %d\n", i1);     printf("i2 = %d\n", i2);      printf("swap integers\n");     swap_2(&i1, &i2);     printf("i1 = %d\n", i1);     printf("i2 = %d\n", i2);      system("pause");     return 0; }  void swap_2(int *x, int *y) {     int temp;      temp = *x;     *x = *y     *y = temp;      **//line 30** } 

you're missing semicolon on line 29.

void swap_2(int *x, int *y) {     int temp;      temp = *x;     *x = *y  <----------- missing semicolon     *y = temp;      **//line 30** } 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -