我指针不能用,怎么把指针去掉代码还是同一个意思

我指针不能用,怎么把指针去掉代码还是同一个意思c,c#,c++

private static unsafe uint[] ToUInt32Array(byte[] data, bool includeLength)
    {
        uint[] numArray;
        int length = data.Length;
        int index = ((length & 3) != 0) ? ((length >> 2) + 1) : (length >> 2);
        if (!includeLength)
        {
            numArray = new uint[index];
        }
        else
        {
            numArray = new uint[index + 1];
            numArray[index] = (uint) length;
        }
        for (int i = 0; i < length; i++)
        {
            uint* numPtr1 = &(numArray[i >> 2]);
            numPtr1[0] |= (uint) (data[i] << (((i & 3) << 3) & 0x1f));
        }
        return numArray;
    }

using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using System;
namespace HelloWorldApplication
{
    class HelloWorld
    {
    
    private static unsafe uint[] ToUInt32Array(byte[] data, bool includeLength)
    {
        uint[] numArray;
        int length = data.Length;
        int index = ((length & 3) != 0) ? ((length >> 2) + 1) : (length >> 2);
        if (!includeLength)
        {
            numArray = new uint[index];
        }
        else
        {
            numArray = new uint[index + 1];
            numArray[index] = (uint) length;
        }
        for (int i = 0; i < length; i++)
        {
            uint* numPtr1 = &(numArray[i >> 2]);
            numPtr1[0] |= (uint) (data[i] << (((i & 3) << 3) & 0x1f));
        }
        return numArray;
    }
    
    private static byte[] ToByteArray(uint[] data, bool includeLength)
    {
        int num = data.Length << 2;
        if (includeLength)
        {
            int num2 = (int) data[data.Length - 1];
            num -= 4;
            if ((num2 < (num - 3)) || (num2 > num))
            {
                return null;
            }
            num = num2;
        }
        byte[] buffer = new byte[num];
        for (int i = 0; i < num; i++)
        {
            buffer[i] = (byte) (data[i >> 2] >> (((i & 3) << 3) & 0x1f));
        }
        return buffer;
    }
    
        private static uint[] Decrypt(uint[] v, uint[] k)
    {
        int n = v.Length - 1;
        if (n < 1)
        {
            return v;
        }
        if (k.Length < 4)
        {
            uint[] Key = new uint[4];
            k.CopyTo(Key, 0);
            k = Key;
        }
        uint z = v[n], y = v[0], delta = 0x9E3779B9, sum, e;
        int p, q = 6 + 52 / (n + 1);
        sum = unchecked((uint)(q * delta));
        while (sum != 0)
        {
            e = sum >> 2 & 3;
            for (p = n; p > 0; p--)
            {
                z = v[p - 1];
                y = unchecked(v[p] -= (z >> 5 ^ y << 2) + (y >> 3 ^ z << 4) ^ (sum ^ y) + (k[p & 3 ^ e] ^ z));
            }
            z = v[n];
            y = unchecked(v[0] -= (z >> 5 ^ y << 2) + (y >> 3 ^ z << 4) ^ (sum ^ y) + (k[p & 3 ^ e] ^ z));
            sum = unchecked(sum - delta);
        }
        return v;
    }
        static void Main(string[] args)
        {
            /* 我的第一个 C# 程序*/
            String aaa = "字符串1";
            Console.WriteLine(aaa);
            byte[] buffer = Encoding.UTF8.GetBytes(aaa);
            foreach(var item in buffer)
            {
                Console.Write(item + " ");
            }
            Console.WriteLine("\n换行");
            byte[] bbb = Encoding.UTF8.GetBytes("字符串2");
            foreach(var item in bbb)
            {
                Console.Write(item + " ");
            }
            Console.WriteLine("\n换行");
            
            byte[] outBuffer=Decrypt( buffer , bbb);
            foreach (var item in outBuffer)
            {
                Console.Write(item + " ");
            }
    
            String la=Encoding.UTF8.GetString(outBuffer);
            Console.WriteLine(la);
            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }
    }
}

您看看这个文章看看有没有帮助:

C 语言指针详解_xiangjiazhi的博客-CSDN博客_对于三次循环,每次的*ptr_分别是多少每次的值是否相等 //////////////////////////////////////C 语言指针详解//////////////////////////////////////////一.指针:在信息工程中指针是一个用来指示一个内存地址的计算机语言的变量或中央处理器(CPU)中寄存器(Register)。指针一般出现在比较近机器语言的语言,如汇编语言或C 语言。面向对象的语言如Java 一般避免用指针。指针一般指向一个函数或一个变量。在使用一个指针时,一个程序既可以直接使用这个指针所储存的内存地 https://blog.csdn.net/xiangjiazhi/article/details/6346807?ops_request_misc=&request_id=&biz_id=102&utm_term=%E6%80%8E%E4%B9%88%E6%8A%8A%E6%8C%87%E9%92%88%E5%8E%BB%E6%8E%89%E4%BB%A3%E7%A0%81%E8%BF%98%E6%98%AF%E5%90%8C%E4%B8%80%E4%B8%AA%E6%84%8F%E6%80%9D&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0-6346807.nonecase&spm=1018.2226.3001.4187

不用指针的话,代码是不行了。就不能用返回数组的方式,必须将数组作为参数传递进来。

指针指向物理内存地址进行调取,不用抓不到

用引用 &