(cir->center)=cir->center
は、以下のものを参照してください。
#include<stdio.h>
struct circle
{
int r;
};
int main(void)
{
struct circle obj;
struct circle* obj1=&obj;
printf("Enter radius : ");
scanf("%d",&obj.r);
/* here membership operator '.' has precedence over '&'
* consider obj.r as a variable x, then normal scanf procdedure
* applies that is you're accessing the memory using &x
*/
printf("Entered radius : %d\n",obj.r);
/* For printf we don't need the '&' */
printf("Enter radius : ");
scanf("%d",&(*obj1).r);
/* Now things have become really dirty
* First we need to use the dereference operator on obj1 which is a
* pointer to structure and then
* user the membership operator '.' to access the variable
* The reference operator '& above here has the least preference
* it gives the address of the chunk of memory dedicated to 'r'
*/
printf("Entered radius : %d\n",(*obj1).r);
printf("Enter radius : ");
scanf("%d",&obj1->r);
/* Well, here the 'obj1->' replaces the '(*obj1).' and
* both have the same meaning.
* The -> is called the indirection operator which makes things
* look neater. Note that you still need the reference operator
* '&' for the structure member 'r'
*/
printf("Entered radius : %d\n",obj1->r);
return 0;
}
上記は有効なものであり、実際にコードで物事をより明確にするために括弧を使用することができます。
括弧は単独では何もしません。彼らはより大きな表現で使用されるときに違いを生むかもしれません。完全な声明を提出してください。 – user694733
違いは、 'cir'はポインタなので' cir.center'はコンパイルされないということです。 –
'(* cir).radius'は' cir-> radius'と同じです –