You need parentheses around "int": sizeof(int)
Don

On Jun 2, 2:41 pm, asit <lipu...@gmail.com> wrote:
> Please consider the following code
>
> // dequeue.cpp : Defines the entry point for the console application.
> //
>
> #include "stdafx.h"
> #include <iostream>
> #include <deque>
> #include <algorithm>
>
> using namespace std;
>
> struct print
> {
>     void operator() (int i)
>     {
>         cout<<"  "<<i;
>     }
>
> }myprint;
>
> int _tmain(int argc, _TCHAR* argv[])
> {
>     deque<int> first;
>     deque<int> second(4, 100);
>     deque<int> third(second.begin(), second.end());
>     deque<int> fourth = third;
>
>     int arr[] = {32, 5, 332, 78, 8};
>
>     deque<int> fifth(arr, arr+(sizeof(arr)/sizeof int));  //Line 28
>
>     cout<<"third : ";
>     for_each(third.begin(), third.end(), myprint);
>     cout<<endl;
>
>     cout<<"fourth : ";
>     for_each(fourth.begin(), fourth.end(), myprint);
>     cout<<endl;
>
>     cout<<"fifth : ";
>     for_each(fifth.begin(), fifth.end(), myprint);
>     cout<<endl;
>     return 0;
>
> }
>
> When I compile the above code it gives the following error.
>
> Line 28 : type 'int' unexpected

-- 
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.

Reply via email to