u can wrote it like this
tag
#include<stdio.h>
main()
{
FILE *o;
o=fopen("in.txt","r");
if((o=fopen("in.txt","r"))!=NULL)
{
int x;
Type: Posts; User: mostafa faisal
u can wrote it like this
tag
#include<stdio.h>
main()
{
FILE *o;
o=fopen("in.txt","r");
if((o=fopen("in.txt","r"))!=NULL)
{
int x;
while (digit = '\0') wrong XXXXXXXXXXXXXXX
digit is an int. value and '\0' is a character so loop will be infinite , second u aren't comparing u are assigning values , i see that the condition...
sorry i forgot to write it
it should be
"printf("Enter %d no.:",i+1);"
this is like a counter.
the condition depends on what u want????
where d belongs is it ]-infinite,1.0] or ]-infinite,1.0[
if u want the 1st one so ur cond. must be if(d<=1.0)
and if u want the 2nd on the cond. must be...
i can see that the program u wrote is about a sorting for a variable length of an array so i'll write for u another code could be much easier to u:
#include<stdio.h>
#include<stdlib.h>
void...
#include<stdio.h>
main()
{
int x,y;
printf("Enter two no.s to ADD:");
scanf("%d%d",&x,&y);
printf("\n%d",x+y);
}
this is what i understand from u
2nd fn. u can write it like this:
int sumAx(double x[][],int r)
{
int i;
double sum=0;
for(i=0,j=1;i<r;i++,j++)
sum+=x[i][j]*j;
return sum;
}
this will be much easier :D
but this declaration :
s.v = malloc(sizeof(your_type) * s.n);
malloc fn. return a void pointer so u have to make a cast type by writing
s.v=(int *)malloc(sizeof(your_type) * s.n);
try this code:
#include <stdio.h>
main()
{
char ch;
printf ("Enter a character: ");
scanf ("%c", &ch);