Click here to Skip to main content
15,891,136 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Learnt something "new" about C/C++ Pin
Sander Rossel11-Nov-15 7:46
professionalSander Rossel11-Nov-15 7:46 
GeneralRe: Learnt something "new" about C/C++ Pin
Afzaal Ahmad Zeeshan11-Nov-15 8:02
professionalAfzaal Ahmad Zeeshan11-Nov-15 8:02 
GeneralRe: Learnt something "new" about C/C++ Pin
BillWoodruff10-Nov-15 5:23
professionalBillWoodruff10-Nov-15 5:23 
GeneralRe: Learnt something "new" about C/C++ Pin
Afzaal Ahmad Zeeshan10-Nov-15 7:33
professionalAfzaal Ahmad Zeeshan10-Nov-15 7:33 
GeneralRe: Learnt something "new" about C/C++ Pin
BillWoodruff10-Nov-15 8:43
professionalBillWoodruff10-Nov-15 8:43 
GeneralRe: Learnt something "new" about C/C++ Pin
Afzaal Ahmad Zeeshan11-Nov-15 7:12
professionalAfzaal Ahmad Zeeshan11-Nov-15 7:12 
GeneralRe: Learnt something "new" about C/C++ Pin
W Balboos, GHB10-Nov-15 5:50
W Balboos, GHB10-Nov-15 5:50 
GeneralRe: Learnt something "new" about C/C++ Pin
k505410-Nov-15 6:14
mvek505410-Nov-15 6:14 
Seems to work fine.
#include <iostream>

int foo(int x, int *a)
{
    return x[a];
}

int main()
{
    int arr[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    int x = 5;

    std::cout << arr[x] << " "
              << x[arr] << " "
              << foo(x, arr) << std::endl;
}

Compiles and runs as expected without warning.
GeneralRe: Learnt something "new" about C/C++ Pin
W Balboos, GHB10-Nov-15 6:20
W Balboos, GHB10-Nov-15 6:20 
AnswerRe: Learnt something "new" about C/C++ Pin
Plamen Dragiyski10-Nov-15 21:58
professionalPlamen Dragiyski10-Nov-15 21:58 
GeneralRe: Learnt something "new" about C/C++ Pin
Kirk 1038982111-Nov-15 4:08
Kirk 1038982111-Nov-15 4:08 
GeneralRe: Learnt something "new" about C/C++ Pin
SeattleC++11-Nov-15 8:28
SeattleC++11-Nov-15 8:28 
GeneralRe: Learnt something "new" about C/C++ Pin
Brian J Rothwell11-Nov-15 10:04
Brian J Rothwell11-Nov-15 10:04 
GeneralRe: Learnt something "new" about C/C++ Pin
Weylyn Cadwell8-Dec-15 9:12
Weylyn Cadwell8-Dec-15 9:12 
GeneralI work with computers too much Pin
PompeyThree9-Nov-15 23:59
PompeyThree9-Nov-15 23:59 
GeneralRe: I work with computers too much Pin
OriginalGriff10-Nov-15 0:06
mveOriginalGriff10-Nov-15 0:06 
GeneralRe: I work with computers too much Pin
Jochen Arndt10-Nov-15 0:14
professionalJochen Arndt10-Nov-15 0:14 
GeneralRe: I work with computers too much Pin
Member 1168325110-Nov-15 0:51
Member 1168325110-Nov-15 0:51 
GeneralRe: I work with computers too much Pin
Abhinav S10-Nov-15 1:20
Abhinav S10-Nov-15 1:20 
GeneralRe: I work with computers too much Pin
chriselst10-Nov-15 1:23
professionalchriselst10-Nov-15 1:23 
GeneralRe: I work with computers too much Pin
Kirk 1038982111-Nov-15 4:09
Kirk 1038982111-Nov-15 4:09 
GeneralRe: I work with computers too much Pin
AndyKEnZ11-Nov-15 5:29
AndyKEnZ11-Nov-15 5:29 
GeneralTime to go home fellows... Pin
Kornfeld Eliyahu Peter9-Nov-15 23:03
professionalKornfeld Eliyahu Peter9-Nov-15 23:03 
GeneralRe: Time to go home fellows... Pin
HobbyProggy9-Nov-15 23:18
professionalHobbyProggy9-Nov-15 23:18 
JokeRe: Time to go home fellows... Pin
phil.o9-Nov-15 23:32
professionalphil.o9-Nov-15 23:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.