If I had a integer n, what does the statement n>>=1 do? convert n to binary, then shift to right one bit? or n stays in decimal format then gets shifted? Thanks.
Type: Posts; User: timhxf
If I had a integer n, what does the statement n>>=1 do? convert n to binary, then shift to right one bit? or n stays in decimal format then gets shifted? Thanks.
thanks all. I know that my code is wrong. I just wondered why it worked at my machine. I am a new comer for C, do not know how the compiler works. So, just a bit curious:)
I compiled this code, and I only got an warning saying passed the imcompatible pointer type, but the program works!
but when I pressed the second time, scanf() should return '0' and it should break out. how can you explain this?
hey, it is me again. I have another question in my mind, ok, this is the code:
#include<stdio.h>
#define max 15
void average5(double a[]);
int main(void)
{
static double...
i have a code like this:
int store(double a[],int limit)
{
int i=0;
while(i<limit&&scanf("%lf",&a[i])==1)
i++;
return i;
}
i have written code to print array rain[3][5], the code is like this:
#include<stdio.h>
void f1(float a[][],int c);
int main(void)
{
int a;
float *b;
i have written the code below:
#include<stdio.h>
void copy1(float a[],float b[],int c);
void copy2(float *d,float *c,int a);
int main(void)
{
int a;
float *b;
hey, i have written this code just to transfer a few number of elements from one array to another two arrays, but I had some problem calling the function. Below is the code:
#include<stdio.h>...
thanks, guys, i understand better!:)
i have an array, let's say "float rain[5][12]", and i have a pointer "float *p", when I make the statement like this"p=rain", then I got a error saying imcompatible pointer type. could anyone...
I can get the result if I use "ar[i]*=mult;" can you tell me why? the result will be assigned to ar[i], but this is a value inside the array, can it be assigned to that?
#include <stdio.h>
#define size 3
void show_array(int ar[],int n);
void mult_array(int mult,int ar[],int n);
int main(void)
{
static int dip[size]={1, 2, 3};
printf("the original...
If "ar" is a pointer to an element in the array, then what does the following statement do?
*(ar++)*=2;
the precedence thing is driving me crazy, where can I find some detailed introduction...
i am more clear now, thanks guys!
I have seen a code like this:
#include <stdio.h>
int data[2]={100,300};
int moredata[2]={200,400};
int main(void)
{
int *p1,*p2,*p3;
p1=p2=data;
I have used a while statement to test the EOF, if it sees EOF, the program should exit. I used command like this "my program<a.txt" and it worked, but when I ran it in the command prompt, I use...
I have written a piece of code to a character and display it a number of times defined by the user, but I got error seems in the scanf statement, can somebody help me? thanks
#include<stdio.h>...
this a simple program to compare two numbers, but it cannot display the correct result, what I got is always "0.00". why?
#include<stdio.h>
double small(double x,double y);
int main(void)
{
...
I see, thanks for you guys to help me, sorry for the bad indentation, I should improve on that also.
I did a review of my code, and came out the code here:
#include<stdio.h>
int main(void)
{...
hi, I am a new lover of C,I have recently written the code below, it is a program to guess the number.
#include<stdio.h>
int main(void)
{
int a;
char response;