int aNumber;
aNumber = aValue / 2;
aNumber = aValue >> 1;
aNumber = aValue * 2;
aNumber = aValue << 1;
aNumber = aValue / 4;
aNumber = aValue >> 2;
aNumber = aValue * 8;
aNumber = aValue << 3;
// etc.
Whats is the "best" way to do operations? When is better to use bit shifting?
...
[Edit1:]
For the seqName, I declare it as a global parameter at the beginning of the file as
char seqName[20];
[Edit2:]
Aren't those number of passing to the program during the actual execution? I got the following message just by using the valgrind tool. The command I input is:
jl@ubuntu:~/work/dsr_analysis$ valgrind --tool=memchec...
hello i have problem with receiving data from serial port in c# in am inserting a new line operator at the end of data buffer. then i send this data buffer on serial port, after this my c# GUI receiver will take this data via Readline() function but it always give me raw data not the actual one how to resolve this problem.
//configuring...
Converting a C++ lib to ANSI C and it seems like though ANSI C doesn't support default values for function variables or am I mistaken?
What I want is something like
int funcName(int foo, bar* = NULL);
Also, is function overloading possible in ANSI C?
Would need
const char* foo_property(foo_t* /* this */, int /* property_number*/);
...
I write two pieces of c programs like following, during memcheck process using Valgrind, a lot of mem leak information is given.
int
GetMemory(int framewidth,
int frameheight,
int SR/*, int blocksize*//*,int ALL_REF_NUM*/)
{
//int i,j;
int memory_size = 0;
//int refnum = ALL_REF_NUM;
int input_search_...
Hi All,
Wanting to see the output of the compiler (in assembly) for some C code, I wrote a simple program in C and generated its assembly file using gcc.
The code is this:
#include <stdio.h>
int main()
{
int i = 0;
if ( i == 0 )
{
printf("testing\n");
}
return 0;
}
The generated assembly fo...
Hi,
How can i convert a float value to char* in C language
...
I use mysqld Ver 5.1.37-2-log for debian-linux-gnu
I perform mysql calls from c++ code with functions mysql_query.
The problem occurs when mysql_query execute procedure, procedure locked on locked table, so mysql_query hangs. If send kill signal to application then we can see lock until table is locked.
Create the following SQL table ...
Hi Gurus,
I am new to OpenCV and I have only Tiny C compiler configured on my Windows XP machine. Can I use this tiny C compiler to compile opencv programs for image manipulations. I have alredy installed python2.6 and opencv2.0 on my windows xp pc. If we can compile how can we do that? I tried on net but found nothing of use.. Please he...
This is sample program from "Beginning Linux Programming" book:
#include <stdio.h>
#include <term.h>
#include <curses.h>
#include <stdlib.h>
int main()
{
setupterm("unlisted", fileno(stdout), (int *)0);
printf("Done.\n");
exit(0);
}
Running it, I have this result:
./badterm
'unlisted': unknown terminal type.
Accordi...
I would like to write a piece of code for inserting a number into a sorted array at the appropriate position (i.e. the array should still remain sorted after insertion)
My data structure doesn't allow duplicates.
I am planning to do something like this:
Find the right index where I should be putting this element using binary search
C...
void display(int a)
{
printf("\n%d",a);
if(--a)
display(a);
printf("\n%d",a);
}
main()
{
display(4);
}
Please explain the above program. i can't understand.what is the output.ya sir i got oupt like this 4 3 2 1 0 1 2 3 how is it sir
...
int main()
{
int a[]={1,2,3,4,5,6,7,8,9,0};
printf("a = %u , &a = %u\n",a,&a);
printf("a+1 = %u , &a+1 = %u\n",a+1,&a+1);
}
how a and &a are internally interpreted?
...
Hi
I would like to write a piece of code which checks, for each network device (e.g. eth0, lo, master devices) some statistics and configuration data about that device.
I could find the statistics data (and most of the configuration data) in /sys/class/net/..., however, I couldn't find any C/C++ API or any entry in procfs/sysfs listing t...
Hi,
I have written some simple inetd-Service in C. It reads a string from the user, compares it to another string and then terminates.
At least, this is what I want it to do. After reaching the return(0);-statement in main(), it simply restarts and presents me a new prompt.
Is there any way to tell inetd that it should terminate the co...
main()
{
int a=1;
void xyz(int,int);
xyz(++a,a++);
printf("%d",a);
}
void xyz(int x,int y)
{
printf("\n%d %d",x,y);
}
...
I'm using Pthreads to create a new tread for each partition after the list is split into the right and left halves (less than and greater than the pivot). I do this recursively until I reach the maximum number of allowed threads.
When I use printfs to follow what goes on in the program, I clearly see that each thread is doing its delega...
How to search fast in a non-sorted array? I am unable to think of any other search mechanism apart from linear search.
Any pointers will be helpful.
...
I want to design a data-structure for storing elements, which will be retrieved only once after insertion and will be deleted after that.
I can't use a stack or queue as the order of retrieval is not guaranteed.
[EDIT] - I would like to use contigous memory (I would prefer to avoid doing malloc every now and then) and also I would pref...
anyone has an idea how to?
...