Re: [algogeeks] what is the error???

2011-09-02 Thread sukran dhawan
define the variable if u wanna remove the error :P

On Wed, Aug 31, 2011 at 8:26 PM, Rajesh Kumar wrote:

> What we do to remove error??
> #include
> extern int var;
> main()
> {
>  var=10;
>  return 0;
> }
>
> Regards
> Rajesh Kumar
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] what is the error???

2011-09-01 Thread rahul vatsa
ya thats rt.

On Thu, Sep 1, 2011 at 4:30 AM, Sanjay Rajpal  wrote:

> @Rahul : I have also mentioned that for the linker error.
>
> You can place a definition int var; after main(), it will work.
> Sanju
> :)
>
>
>
> On Wed, Aug 31, 2011 at 11:14 AM, rahul vatsa wrote:
>
>> @sanju,  if u declare a variable with extern, at compile time its defn is
>> nt looked for, rather @ link time corresponding defn is looked for by the
>> linker. nd if the defn is nt ther, it will raise a linker error, as in case
>> of this prog
>>
>> @rahul, ya off course, for a variable to be global it hs to be defined at
>> file scope.
>>
>>
>>
>>
>> On Wed, Aug 31, 2011 at 11:29 AM, Sanjay Rajpal  wrote:
>>
>>>  Linker error, failed to find symbol 'var'.
>>>
>>>
>>> Sanju
>>> :)
>>>
>>>
>>>
>>> On Wed, Aug 31, 2011 at 8:25 AM, rahul sharma 
>>> wrote:
>>>
 but it is defined inside mainu mean to say for varibale to be
 gloabal it must be defines outsyd all fxns??


 On Wed, Aug 31, 2011 at 8:35 PM, Ashima . wrote:

> u hv just declared the variable and not defined it.So no memory is
> allocated to var. so u l get the undefined reference error.
> either remove extern or define new local variable int var =10;
> Ashima
> M.Sc.(Tech)Information Systems
> 4th year
> BITS Pilani
> Rajasthan
>
>
>
>
> On Wed, Aug 31, 2011 at 7:56 AM, Rajesh Kumar  > wrote:
>
>> What we do to remove error??
>>  #include
>> extern int var;
>> main()
>> {
>>  var=10;
>>  return 0;
>> }
>>
>> Regards
>> Rajesh Kumar
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>   --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] what is the error???

2011-09-01 Thread Sanjay Rajpal
@Rahul : I have also mentioned that for the linker error.

You can place a definition int var; after main(), it will work.
Sanju
:)



On Wed, Aug 31, 2011 at 11:14 AM, rahul vatsa  wrote:

> @sanju,  if u declare a variable with extern, at compile time its defn is
> nt looked for, rather @ link time corresponding defn is looked for by the
> linker. nd if the defn is nt ther, it will raise a linker error, as in case
> of this prog
>
> @rahul, ya off course, for a variable to be global it hs to be defined at
> file scope.
>
>
>
>
> On Wed, Aug 31, 2011 at 11:29 AM, Sanjay Rajpal  wrote:
>
>>  Linker error, failed to find symbol 'var'.
>>
>>
>> Sanju
>> :)
>>
>>
>>
>> On Wed, Aug 31, 2011 at 8:25 AM, rahul sharma wrote:
>>
>>> but it is defined inside mainu mean to say for varibale to be gloabal
>>> it must be defines outsyd all fxns??
>>>
>>>
>>> On Wed, Aug 31, 2011 at 8:35 PM, Ashima .  wrote:
>>>
 u hv just declared the variable and not defined it.So no memory is
 allocated to var. so u l get the undefined reference error.
 either remove extern or define new local variable int var =10;
 Ashima
 M.Sc.(Tech)Information Systems
 4th year
 BITS Pilani
 Rajasthan




 On Wed, Aug 31, 2011 at 7:56 AM, Rajesh Kumar 
 wrote:

> What we do to remove error??
>  #include
> extern int var;
> main()
> {
>  var=10;
>  return 0;
> }
>
> Regards
> Rajesh Kumar
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>   --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] what is the error???

2011-08-31 Thread rahul vatsa
@sanju,  if u declare a variable with extern, at compile time its defn is nt
looked for, rather @ link time corresponding defn is looked for by the
linker. nd if the defn is nt ther, it will raise a linker error, as in case
of this prog

@rahul, ya off course, for a variable to be global it hs to be defined at
file scope.



On Wed, Aug 31, 2011 at 11:29 AM, Sanjay Rajpal  wrote:

> Linker error, failed to find symbol 'var'.
>
>
> Sanju
> :)
>
>
>
> On Wed, Aug 31, 2011 at 8:25 AM, rahul sharma wrote:
>
>> but it is defined inside mainu mean to say for varibale to be gloabal
>> it must be defines outsyd all fxns??
>>
>>
>> On Wed, Aug 31, 2011 at 8:35 PM, Ashima .  wrote:
>>
>>> u hv just declared the variable and not defined it.So no memory is
>>> allocated to var. so u l get the undefined reference error.
>>> either remove extern or define new local variable int var =10;
>>> Ashima
>>> M.Sc.(Tech)Information Systems
>>> 4th year
>>> BITS Pilani
>>> Rajasthan
>>>
>>>
>>>
>>>
>>> On Wed, Aug 31, 2011 at 7:56 AM, Rajesh Kumar 
>>> wrote:
>>>
 What we do to remove error??
  #include
 extern int var;
 main()
 {
  var=10;
  return 0;
 }

 Regards
 Rajesh Kumar


 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] what is the error???

2011-08-31 Thread rahul sharma
but it is defined inside mainu mean to say for varibale to be gloabal it
must be defines outsyd all fxns??

On Wed, Aug 31, 2011 at 8:35 PM, Ashima .  wrote:

> u hv just declared the variable and not defined it.So no memory is
> allocated to var. so u l get the undefined reference error.
> either remove extern or define new local variable int var =10;
> Ashima
> M.Sc.(Tech)Information Systems
> 4th year
> BITS Pilani
> Rajasthan
>
>
>
>
> On Wed, Aug 31, 2011 at 7:56 AM, Rajesh Kumar wrote:
>
>> What we do to remove error??
>>  #include
>> extern int var;
>> main()
>> {
>>  var=10;
>>  return 0;
>> }
>>
>> Regards
>> Rajesh Kumar
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] what is the error???

2011-08-31 Thread Sanjay Rajpal
Linker error, failed to find symbol 'var'.


Sanju
:)



On Wed, Aug 31, 2011 at 8:25 AM, rahul sharma wrote:

> but it is defined inside mainu mean to say for varibale to be gloabal
> it must be defines outsyd all fxns??
>
>
> On Wed, Aug 31, 2011 at 8:35 PM, Ashima .  wrote:
>
>> u hv just declared the variable and not defined it.So no memory is
>> allocated to var. so u l get the undefined reference error.
>> either remove extern or define new local variable int var =10;
>> Ashima
>> M.Sc.(Tech)Information Systems
>> 4th year
>> BITS Pilani
>> Rajasthan
>>
>>
>>
>>
>> On Wed, Aug 31, 2011 at 7:56 AM, Rajesh Kumar wrote:
>>
>>> What we do to remove error??
>>>  #include
>>> extern int var;
>>> main()
>>> {
>>>  var=10;
>>>  return 0;
>>> }
>>>
>>> Regards
>>> Rajesh Kumar
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] what is the error???

2011-08-31 Thread Ashima .
u hv just declared the variable and not defined it.So no memory is allocated
to var. so u l get the undefined reference error.
either remove extern or define new local variable int var =10;
Ashima
M.Sc.(Tech)Information Systems
4th year
BITS Pilani
Rajasthan




On Wed, Aug 31, 2011 at 7:56 AM, Rajesh Kumar wrote:

> What we do to remove error??
>  #include
> extern int var;
> main()
> {
>  var=10;
>  return 0;
> }
>
> Regards
> Rajesh Kumar
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] what is the error???

2011-08-31 Thread sachin goyal
extern try to find the definition of variable var but not able to find so
gives the error

On Wed, Aug 31, 2011 at 8:26 PM, Rajesh Kumar wrote:

> What we do to remove error??
> #include
> extern int var;
> main()
> {
>  var=10;
>  return 0;
> }
>
> Regards
> Rajesh Kumar
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] what is the error???

2011-08-31 Thread Rajesh Kumar
What we do to remove error??
#include
extern int var;
main()
{
 var=10;
 return 0;
}

Regards
Rajesh Kumar

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] What is the error in the following function

2011-02-22 Thread Terence
Variable start and hex_buf point to string constant, which can not be 
modified.

Change:

char *start = "12.12.12.12.12976665176069214";
char *hex_buf = "65003a0a";

to:

char start[] = "12.12.12.12.12976665176069214";
char hex_buf[] = "65003a0a";


On 2011-2-15 15:01, dinesh bansal wrote:

Hi All,

Can you please point me to the error in the following function. It 
gives segmentation fault.


int main()
{
char *start = "12.12.12.12.12976665176069214";
char *hex_buf = "65003a0a";
unsigned short i, j = 0;
int new_len2 = strlen(hex_buf);
for (i = 0; ((j+1) < new_len2); i+=2,j+=2)
{
start[i] = hex_buf[j];
start[i+1] = hex_buf[j+1];
}
}

Thanks,
--
Dinesh Bansal
The Law of Win says, "Let's not do it your way or my way; let's do it 
the best way."

--
You received this message because you are subscribed to the Google 
Groups "Algorithm Geeks" group.

To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.


--
You received this message because you are subscribed to the Google Groups "Algorithm 
Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] What is the error in the following function

2011-02-15 Thread dinesh bansal
got it clear.. thanks guys.

On Tue, Feb 15, 2011 at 1:46 PM, jagannath prasad das
wrote:

> here start is pointing to string constant which is created in read-only
> memory which can't be changed.so modifying it in the for loop causes
> segmentation fault
> declare it as a array type
>
>
> On Tue, Feb 15, 2011 at 12:36 PM, rahul  wrote:
>
>> char *start is const char *start, pointer to const char, u can't
>> derefernce it and change it.
>> take a char start[256].try this.
>>
>>
>> On Tue, Feb 15, 2011 at 12:31 PM, dinesh bansal wrote:
>>
>>> Hi All,
>>>
>>> Can you please point me to the error in the following function. It gives
>>> segmentation fault.
>>>
>>> int main()
>>> {
>>> char *start = "12.12.12.12.12976665176069214";
>>> char *hex_buf = "65003a0a";
>>> unsigned short i, j = 0;
>>> int new_len2 = strlen(hex_buf);
>>> for (i = 0; ((j+1) < new_len2); i+=2,j+=2)
>>> {
>>> start[i] = hex_buf[j];
>>> start[i+1] = hex_buf[j+1];
>>> }
>>> }
>>>
>>> Thanks,
>>> --
>>> Dinesh Bansal
>>> The Law of Win says, "Let's not do it your way or my way; let's do it the
>>> best way."
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Dinesh Bansal
The Law of Win says, "Let's not do it your way or my way; let's do it the
best way."

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] What is the error in the following function

2011-02-15 Thread jagannath prasad das
here start is pointing to string constant which is created in read-only
memory which can't be changed.so modifying it in the for loop causes
segmentation fault
declare it as a array type

On Tue, Feb 15, 2011 at 12:36 PM, rahul  wrote:

> char *start is const char *start, pointer to const char, u can't derefernce
> it and change it.
> take a char start[256].try this.
>
>
> On Tue, Feb 15, 2011 at 12:31 PM, dinesh bansal wrote:
>
>> Hi All,
>>
>> Can you please point me to the error in the following function. It gives
>> segmentation fault.
>>
>> int main()
>> {
>> char *start = "12.12.12.12.12976665176069214";
>> char *hex_buf = "65003a0a";
>> unsigned short i, j = 0;
>> int new_len2 = strlen(hex_buf);
>> for (i = 0; ((j+1) < new_len2); i+=2,j+=2)
>> {
>> start[i] = hex_buf[j];
>> start[i+1] = hex_buf[j+1];
>> }
>> }
>>
>> Thanks,
>> --
>> Dinesh Bansal
>> The Law of Win says, "Let's not do it your way or my way; let's do it the
>> best way."
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] What is the error in the following function

2011-02-14 Thread rahul
char *start is const char *start, pointer to const char, u can't derefernce
it and change it.
take a char start[256].try this.

On Tue, Feb 15, 2011 at 12:31 PM, dinesh bansal  wrote:

> Hi All,
>
> Can you please point me to the error in the following function. It gives
> segmentation fault.
>
> int main()
> {
> char *start = "12.12.12.12.12976665176069214";
> char *hex_buf = "65003a0a";
> unsigned short i, j = 0;
> int new_len2 = strlen(hex_buf);
> for (i = 0; ((j+1) < new_len2); i+=2,j+=2)
> {
> start[i] = hex_buf[j];
> start[i+1] = hex_buf[j+1];
> }
> }
>
> Thanks,
> --
> Dinesh Bansal
> The Law of Win says, "Let's not do it your way or my way; let's do it the
> best way."
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] What is the error in the following function

2011-02-14 Thread dinesh bansal
Hi All,

Can you please point me to the error in the following function. It gives
segmentation fault.

int main()
{
char *start = "12.12.12.12.12976665176069214";
char *hex_buf = "65003a0a";
unsigned short i, j = 0;
int new_len2 = strlen(hex_buf);
for (i = 0; ((j+1) < new_len2); i+=2,j+=2)
{
start[i] = hex_buf[j];
start[i+1] = hex_buf[j+1];
}
}

Thanks,
-- 
Dinesh Bansal
The Law of Win says, "Let's not do it your way or my way; let's do it the
best way."

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.