I have one problem, and i have no idea what is happening?
THE output gives some strange things:

type of your cpu is:
amd
cpu speed is:
123
enter the year when it's produced
2000
enter the price of your computer
scanf: floating point formats not linked
abnormal program termination

Please, help me on this! thanks.
__________________________

#include <stdio.h>

struct computer
	{
		float cost;
		int year;
		int cpu_speed;
		char cpu_type[16];
	};

typedef struct computer SC;

void DataReceive(SC *ptr_s);

int main()
{
	SC model;

	DataReceive(&model);

	printf("Here are what you've entered\n");
	printf("Year is: %d\n", model.year);
	printf("Price is: %f\n", model.cost);
	printf("Cpu type is: %s\n", model.cpu_type);
	printf("Cpu speed is: %d\n", model.cpu_speed);
	
	

	
	return 0;
}
void DataReceive(SC *ptr_s)
{
	printf("Type of your cpu is:\n");
	gets((*ptr_s).cpu_type);
	
	printf("Cpu speed is:\n");
	scanf("%d", &(*ptr_s).cpu_speed);
	
	printf("enter the year when it's produced\n");
	scanf("%d", &(*ptr_s).year);
	
	printf("Enter the price of your computer\n");
	scanf("%f", &(*ptr_s).cost);

}

I did not get any errors with the code you posted. What compiler and os are you using?

line 35: never ever use gets() for anything because it can corrupt the memory of your program. If you type something that is longer than the destination buffer can hold, gets() will just scribble the remaining characters into all adjucent memory. You should use fgets() instead, like this: fgets((*ptr_s).cpu_type, sizeof((*ptr_s).cpu_type), stdin);

I'm using TurboC (OS is winxp).

> I'm using TurboC (OS is winxp).
Get a real compiler then.

You've bought a Ferrari, and you've taken the engine out and instead tided a horse to the front of it. For example, however many GB of memory you have, your compiler only sees 640K of it.

> scanf: floating point formats not linked
Interestingly, if you paste this exact text into a search engine, you'll get lots of hits.
Try to imagine that you're not the first person to ever see an error message.

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.