#include "stdafx.h"
#include "stdio.h"

void swap (int a, int b);
int main (void)
{
int a,b;

printf("enter 2 positive integers");
scanf("%d",&a,&b);
swap (a,b);
printf("d%d,a,b\n");

}
void swap (int a, int b)
{
	int swap (a,b);
}

I have one error
(20) : error C2078: too many initializers

this is wrong... you are missing one "%d"

scanf("%d",&a,&b);

corrected code

scanf("%d %d",&a,&b);

This is also wrong...

printf("d%d,a,b\n");

Corrected code

printf("%d %d\n",a,b);

Your swap function is entirely wrong. You need to pass pointers to integers as the parameters, and do the swapping by writing to where the pointer points to.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.