if I have a macro defined as
#define swap(a,b,c) c t; t=a,a=b,b=t;
The above would work if a,b were numbers and 'c' was a data type like int.but it wont work for float * or any...
Type: Posts; User: eklavya8
if I have a macro defined as
#define swap(a,b,c) c t; t=a,a=b,b=t;
The above would work if a,b were numbers and 'c' was a data type like int.but it wont work for float * or any...
hi if i have a struct as given below-
struct a
{
char *name;
int i;
}ob;
main()
int a[]={1,5,6,8};
for(int j=0;j<5;j++)
{
printf("%d",*a);
a++;
}
gives this error,ny idea why?
yes i thought so too,but as i mentioned the pointers dont seem to change there current location even after the statement.
when do we get an lvalue required error and an rvalue required error.
ok,
say x and y are pointers to mem loc 500.
what does the stmt-
y++=x++ do;
where do x and y point now?why?
apparently they point to the same loc but i dunno why?
thanks all of u.
very grateful.
ok
p=arr;//missed that
int arr[3]={2,3,4};
char *p;
p=(int *) (p+1)
printf("%d",*p)
now p has value 0 why?
i am sorry i meant the other way round. final answer is in char.
so can i assume that in this case the higher order bits will be lost?
when we type cast a char to an int do we end up with the lower order bits or the higher order?
Can any one tell me why the out put is "1 40 0" and not "1 40 1"
main()
{
int x;
printf("%d%d%d",x<=50,x=40,x>=10);
getch();
}
hi!
does any one have a prewritten class for handling really big integers(100 digits....).
Just basic operations
Its really helpful in coding contests, like java has the inbuilt BigInteger class....
Thanx for pointing me in the right direction-
vector< vector<int> > myvec(n,vector<int>(n));
works perfectly!
cheers!
hi!
does anyone know a good way to implement dynamic 2d array in c++ using STL?
could anyone tell me why code 1 is slower than the second code-
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define REP(i,n) for(i=0;i<n;++i)...
thanks a lot!
hi all!
Thanx for all the help.
the line
int start=bossHealth.begin()-find(all(bossHealth),min_element(all(bossHealth) ) );
had the bug so I replaced it and now i am fine,but I still cant...
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
Hi!
dont spend more than 10 minutes reading this,I probably should not even be posting this.
Any way I have this piece of code which has some syntax error in the STL part and I cannot make any...
thank you all some really nice stuff learnt.
Hi!
Does any one know the best war to create a 2dimensional array of booleans.
I know how to create a 1D array using bitset but cant go any further.
Cheers!
PS:can u tell me a little about the...
Thanks to all of you (Mats in particular)!
cin.ignore() worked perfectly.(yes I did have a cin>>x statement).
Thanks once again ,I learnt something new .
cheers!
ps:In general what are the...
In the following code why does the getline statement get skipped in the first iteration.
vector<string> names(r);
for(i=0;i<r;i++)
{
getline(cin,names[i],'\n');
cout<<i<<endl;
i had tried this method but it seems to be giving huge "STL style" errors.