Thanks for your reply!

> No, use rb_cvar_set to set class variables.  rb_ivar_set sets
> an instance variable of a class instance.  I.E.,
>
>   class Foo
>     @foo = "ivar"
>     @@foo = "cvar"
>   end

Will the instance variable "@foo"'s value declared as the above
example can be referenced in an object of Class Foo?

Please look at following example:

class Foo
  @foo = "ivar"

  def printFoo
    puts @foo
  end
end

f=Foo.new
f.printFoo
  ========> nil

So now, I am curious to know, why the function rb_ivar_set allows
passing a "klass" as the first parameter to set value of a instance
variable which can't be referenced by its objects.