Possible Duplicate:
Sizeof an array in the C programming language?
    #include "stdafx.h"
    #include <string>
    #include <iostream>
    using namespace std;
    string a[] = {"some", "text"};
    void test(string a[])
    {
        int size_of_a = sizeof(a) /sizeof(a[0]);
        cout << size_of_a; 
    }
    int _tmain(int argc, _TCHAR* argv[])
    {
        test(a); //gives 0
        int size_of_a = sizeof(a) /sizeof(a[0]);
        cout << size_of_a; //gives 2
        return 0;
    }
as u can see in the comment test(a) gives 0 instead of 2 as i would expect. Could someone explain why and how could i correct it? thanks
 
     
     
    